package org.sky.model;

import org.sky.util.ExcelResources;

import javax.persistence.*;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 12-10-17
 * Time: 上午2:04
 * To change this template use FileUtil | Settings | FileUtil Templates.
 */

@Entity
public class RoomUsed {

    /**
     * 编号
     */
    private int id;

    /**
     * 使用k房
     */
    private Room room = new Room();

    /**
     * K房使用开始时间
     */
    private Date startTime;

    /**
     * K房使用结束时间
     */
    private Date endTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 房费
     */
    private double money = 0.0d;

    /**
     * 使用套餐
     */
    private Meal meal = new Meal();

    /**
     * 是否使用
     * 0:未结账
     * 1:已结账
     */
    private PayForOrder pay = PayForOrder.NOT_PAY;

    /**
     * 预约订单号
     */
    private Booking booking = new Booking();

    /**
     * 实际到场人数
     */
    private int singerNum;

    /**
     * 额外费用 （包括酒水、事物）
     */
    private double extraMoney;

    /**
     * 收款人
     */
    private String cashier;

    @Id
    @GeneratedValue
    @ExcelResources(title = "编号", order = 1)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "roomId", nullable = false)
    @ExcelResources(title = "房间编号", order = 2)
    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    @Column(nullable = false)
    @ExcelResources(title = "开始时间", order = 4)
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    @ExcelResources(title = "结束时间", order = 5)
    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Column(columnDefinition = "double default 0.0", nullable = false)
    @ExcelResources(title = "房费", order = 7)
    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    @ManyToOne
    @JoinColumn(name = "mealId", nullable = false)
    @ExcelResources(title = "套餐", order = 3)
    public Meal getMeal() {
        return meal;
    }

    public void setMeal(Meal meal) {
        this.meal = meal;
    }

    @Enumerated(EnumType.ORDINAL)
    @Column(columnDefinition = "INT default 0", nullable = false)
    @ExcelResources(title = "是否付钱", order = 8)
    public PayForOrder getPay() {
        return pay;
    }

    public void setPay(PayForOrder pay) {
        this.pay = pay;
    }

    @OneToOne
    @JoinColumn(name = "orderId", nullable = false)
    @ExcelResources(title = "系统编号", order = 11)
    public Booking getBooking() {
        return booking;
    }

    public void setBooking(Booking booking) {
        this.booking = booking;
    }

    @Column(nullable = false)
    @ExcelResources(title = "创建时间", order = 6)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Column(columnDefinition = "double default 0.0", nullable = false)
    @ExcelResources(title = "额外金钱", order = 9)
    public double getExtraMoney() {
        return extraMoney;
    }

    public void setExtraMoney(double extraMoney) {
        this.extraMoney = extraMoney;
    }

    @Column(nullable = false)
    @ExcelResources(title = "人数", order = 10)
    public int getSingerNum() {
        return singerNum;
    }

    public void setSingerNum(int singerNum) {
        this.singerNum = singerNum;
    }

    @Column(length = 10)
    @ExcelResources(title = "收银员" , order = 12)
    public String getCashier() {
        return cashier;
    }

    public void setCashier(String cashier) {
        this.cashier = cashier;
    }

    public RoomUsed(int id, Date createTime, Date endTime, PayForOrder pay, Date startTime, Meal meal,
                    double money, Booking booking , Room room, double extraMoney, int singerNum,String cashier) {
        super();
        this.id = id;
        this.createTime = createTime;
        this.endTime = endTime;
        this.pay = pay;
        this.meal = meal;
        this.booking = booking;
        this.room = room;
        this.money = money;
        this.extraMoney = extraMoney;
        this.singerNum = singerNum;
        this.startTime = startTime;
        this.cashier = cashier;
    }

    public RoomUsed() {
        super();
    }

    @Override
    public String toString() {
        return "RoomUsed [id=" + id + ",room=" + room + ", meal=" + meal + ", createTime="
                + createTime + ", endTime=" + endTime + ", startTime=" + startTime + ", money=" + money +
                ", pay=" + pay +", extraMoney=" + extraMoney + ", singerNum="
                + singerNum +  ", booking=" + booking + ",cashier="+cashier+"]";
    }

}
